package com.qf.dao.daoimpl;

import com.qf.dao.AdminDao;
import com.qf.pojo.Admin;
import com.qf.utils.dbutilUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

/**
 * @author Mr.Liu
 * @date 2021/11/17 20:00
 */

public class AdminDaoImpl implements AdminDao {
    @Override
    public Admin findAdmin(String adminname) throws SQLException {
        QueryRunner qr = new QueryRunner(dbutilUtils.getDataSource());
        String sql = "select * from admin where adminname = ?";
        Admin admin = qr.query(sql, new BeanHandler<Admin>(Admin.class), adminname);
        return admin;
    }
}
